<?php
require_once("conf/db_connection.php");

$trip_id = $_GET["id"];
$return_str = "";

$query_trip = "SELECT * FROM trip_detail WHERE id='".$trip_id."'";
$result_trip = mysql_query($query_trip) or die("SELECT TRIP DETAIL ".mysql_error());
$row_trip = mysql_fetch_array($result_trip);

$opt_source = "";
$query_source = "SELECT * FROM lookup_source WHERE is_deleted='0'";
$result_source = mysql_query($query_source) or die("SELECT SOURCE LIST ".mysql_error());
while($row_source = mysql_fetch_array($result_source))
{
	$opt_source .= "<option value='".$row_source['name']."'>".strtoupper($row_source['name'])."</option>";
}

$opt_cont_type = "";
$opt_cont_type .= "<option value='empty'>A - Empty</option>";
$opt_cont_type .= "<option value='loaded'>B - Loaded</option>";
$opt_cont_type .= "<option value='other'>C - Other</option>";

$opt_cont_size = "";
$opt_cont_size .= "<option value='1x20'>1x20</option>";
$opt_cont_size .= "<option value='2x20'>2x20</option>";
$opt_cont_size .= "<option value='1x10'>1x10</option>";
$opt_cont_size .= "<option value='4x10'>4x10</option>";

$opt_esize = "";
$query_esize = "SELECT DISTINCT(equipment_size) FROM truck WHERE equipment_size!='' AND equipment_size!='n/a' AND is_deleted='0' ORDER BY equipment_size ASC";
$result_esize = mysql_query($query_esize) or die("SELECT EQUIP SIZE LIST ".mysql_error());
while($row_esize = mysql_fetch_array($result_esize))
{
	$opt_esize .= "<option value='".$row_esize['equipment_size']."'>".strtoupper($row_esize['equipment_size'])."</option>";
}

$return_str = "<table id='pop_table' border='0' style='margin:25px 25px 0px 25px; padding: 0px auto;width:950px;height:280px;background-color:#FFFFFF;'>
<thead style='height:15%;'>
<tr id='hor-minimalist-b'>
	<th colspan='8'><br /><br />Booking Details</th>
</tr>
</thead>
<tbody>
<tr>
	<td class='label'>Source</td>
	<td class='td_input'><select id='txt_source' name='txt_source'>".$opt_source."</select></td>
	<td class='label'>Booking #</td>
	<td class='td_input'><input id='txt_booking_num' name='txt_booking_num' type='text' value='".$row_trip['commodity_type']."' /></td>
	<td class='label'>Container<br />Type</td>
	<td class='td_input'><select id='txt_container_type' name='txt_container_type'>".$opt_cont_type."</select></td>
	<td class='label'>Container<br />Size</td>
	<td class='td_input'><select id='txt_container_size' name='txt_container_size'>".$opt_cont_size."</select></td>
</tr>
<tr>
	<td class='label'>Truck<br />Type</td>
	<td class='td_input'><select id='txt_truck_type' name='txt_truck_type'>".$opt_esize."</select></td>
	<td class='label'>Customer</td>
	<td class='td_input'><input id='txt_customer' name='txt_customer' type='text' value='".$row_trip['positioning_date']."' /></td>
	<td class='label'>Contact<br />Person</td>
	<td class='td_input'><input  id='txt_contact_person' name='txt_contact_person' type='text' value='".$row_trip['positioning_time']."' /></td>
	<td class='label'>Contact #</td>
	<td class='td_input'><input id='txt_contact_num' name='txt_contact_num' type='text' value='".$row_trip['receive_date_time']."' /></td>	
</tr>
<tr>
	<td class='label'>Customer<br />Address</td>
	<td class='td_input' colspan='3'><textarea  id='txt_customer_address' name='txt_customer_address' cols='40' rows='1'>".$row_trip['pick_address']."</textarea></td>
	<td class='label'>Delivery<br />Date</td>
	<td class='td_input'><input readonly='readonly' id='txt_del_date' name='txt_del_date' type='text' value='".$row_trip['positioning_time']."' /></td>
	<td class='label'>Delivery<br />Time</td>
	<td class='td_input'><input id='txt_del_time' name='txt_del_time' type='text' value='".$row_trip['receive_date_time']."' /></td>	
</tr>
</tbody>
</table>";

$return_str .= "<table id='pop_table' border='0' style='margin:0px 25px 25px 25px; padding: 0px auto;width:950px;height:120px;background-color:#FFFFFF;'>
<thead style='height:2%;'>
<tr id='hor-minimalist-b'>
	<th colspan='8'>&nbsp</th>
</tr>
</thead>
<tbody>
<tr>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
</tr>
<tr>
	<td style='text-align:center;' colspan='4'>
		<input onClick='confirmBooking()'style='width:auto;' type='button' value='Submit' />&nbsp;&nbsp;&nbsp;
		<input onClick='closePopDiv()' style='width:auto;' type='button' value='Close' />
	</td>
</tr>
<tr>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
</tr>
</tbody>
</table>
<input id='hf_truck_id' name='hf_truck_id' type='hidden' />
<input id='hf_assign_trip_id' name='hf_assign_trip_id' type='hidden' value='".$trip_id."' />";
echo $return_str;
?>